package me.ratel.demo.wechat.entities;

import me.ratel.demo.eBook.infrastructure.utils.XmlUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.io.InputStream;

/**
 * @author Administrator
 * @time 2016/8/28 15:42
 */
@XmlRootElement(name = "xml")
public class PayNotificationResponse {
    private static final Logger log = LoggerFactory.getLogger(PayNotificationResponse.class);

    @XmlElement(name = "return_code")
    @XmlJavaTypeAdapter(value = AdaptorCDATA.class)
    private String returnCode;

    @XmlElement(name = "return_msg")
    @XmlJavaTypeAdapter(value = AdaptorCDATA.class)
    private String returnMsg;

    @XmlElement(name = "out_trade_no")
    @XmlJavaTypeAdapter(value = AdaptorCDATA.class)
    private String outTradeNo;

    public PayNotificationResponse toBean(InputStream xml) {
        return XmlUtils.toBean(xml, PayNotificationResponse.class);
    }
}
